package com.yunfangdata.service.impl;


import com.yunfangdata.domain.Curriculumtable;
import com.yunfangdata.mapper.CurriculumtableMapper;
import com.yunfangdata.query.QueryObject;
import com.yunfangdata.service.ICurriculumtableService;
import com.yunfangdata.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CurriculumtableServiceImpl implements ICurriculumtableService {


    @Autowired
    private CurriculumtableMapper curriculumtableMapper;

    public CurriculumtableServiceImpl() {
    }


    public PageResult query(QueryObject qo) {
        //1:查总条数
        int total = curriculumtableMapper.queryForCount(qo);
        if (total == 0) {
            return new PageResult();
        }
        //2:查分页数据
        List<Curriculumtable> rows = curriculumtableMapper.queryForList(qo);

        return new PageResult(total, rows);
    }

    public void save(Curriculumtable entity) {
        curriculumtableMapper.insert(entity);
    }

    public void delete(Long id) {
        curriculumtableMapper.deleteByPrimaryKey(id);
    }

    public void update(Curriculumtable entity) {
        curriculumtableMapper.updateByPrimaryKey(entity);
    }
}